package com.lcb.jmm.volatiledome;

/****
 * @Author:lcb
 * @Description:查看volatile汇编指令
 * @Date: 2020-12-23 11:31
 *****/
public class Singleton {

    private volatile static Singleton myinstance;

    /**
     * 查看汇编指令
     * -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly -Xcomp
     */
    public static Singleton getinstance() {
        if (myinstance == null) {
            synchronized (Singleton.class) {
                if (myinstance == null) {
                    myinstance = new Singleton();
                }
            }
        }
        return myinstance;
    }

    public static void main(String[] args) {
        Singleton.getinstance();
    }
}
